package gui;

import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.JButton;

import ctr.Gctr;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class CreateGuest extends JPanel {

	/**
	 * 
	 */
	private static final long serialVersionUID = -8590673751635295139L;
	private JTextField countryField;
	private JTextField addressField;
	private JTextField lnameField;
	private JTextField fnameField;
	private JTextField phoneField;
	private JTextField emailField;
	private JTextField travelAgencyField;
	private JButton t;

	/**
	 * Create the panel.
	 */
	public CreateGuest() {
		setLayout(null);
		
		countryField = new JTextField();
		countryField.setBounds(311, 95, 116, 22);
		add(countryField);
		countryField.setColumns(10);
		
		addressField = new JTextField();
		addressField.setBounds(311, 65, 116, 22);
		add(addressField);
		addressField.setColumns(10);
		
		lnameField = new JTextField();
		lnameField.setBounds(311, 35, 116, 22);
		add(lnameField);
		lnameField.setColumns(10);
		
		fnameField = new JTextField();
		fnameField.setBounds(311, 5, 116, 22);
		add(fnameField);
		fnameField.setColumns(10);
		
		phoneField = new JTextField();
		phoneField.setBounds(311, 125, 116, 22);
		add(phoneField);
		phoneField.setColumns(10);
		
		emailField = new JTextField();
		emailField.setBounds(311, 155, 116, 22);
		add(emailField);
		emailField.setColumns(10);
		
		travelAgencyField = new JTextField();
		travelAgencyField.setBounds(311, 185, 116, 22);
		add(travelAgencyField);
		travelAgencyField.setColumns(10);
		
		JLabel lblFirstName = new JLabel("First Name");
		lblFirstName.setBounds(46, 5, 62, 16);
		add(lblFirstName);
		
		JLabel lblLastName = new JLabel("Last Name");
		lblLastName.setBounds(46, 35, 60, 16);
		add(lblLastName);
		
		JLabel lblAddress = new JLabel("Address");
		lblAddress.setBounds(46, 65, 46, 16);
		add(lblAddress);
		
		JLabel Country = new JLabel("Country");
		Country.setBounds(46, 95, 44, 16);
		add(Country);
		
		JLabel lblNewLabel = new JLabel("Phone");
		lblNewLabel.setBounds(46, 125, 35, 16);
		add(lblNewLabel);
		
		JLabel lblNewLabel_1 = new JLabel("Email");
		lblNewLabel_1.setBounds(46, 155, 31, 16);
		add(lblNewLabel_1);
		
		JLabel lblNewLabel_2 = new JLabel("Travel Agency");
		lblNewLabel_2.setBounds(46, 185, 81, 16);
		add(lblNewLabel_2);
		
		t = new JButton("Create Guest");
		t.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				createGuest(e);
			}
		});
		t.setBounds(330, 245, 97, 25);
		add(t);

	}
	
	private void createGuest(java.awt.event.ActionEvent make) {//GEN-FIRST:event_insertEmp
        Gctr gCtr = new Gctr();
  
        String fname = fnameField.getText();
        String lname = lnameField.getText();
        String address = addressField.getText();
        String country = countryField.getText();
        String phone = phoneField.getText();
        String email = emailField.getText();
        String travelAgency = travelAgencyField.getText();
        
       
            gCtr.insertNew(fname, lname, address, country, phone, email, travelAgency);
        
    }//GEN-LAST:event_insertEmp

}
